VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
END
Attribute VB_Name = "clsNodes"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Private prvNodes As New Collection

Public Function Add(mCaption As String, mLevel As Integer, mIsParent As Boolean, _
                                Optional mVisible, Optional mExpanded, Optional mVisibleIdx, _
                                Optional mBookmark, Optional mBmpFileName, Optional mSelected, Optional mSyncIdx, _
                                Optional mItemData)
  Dim newitem As New clsItem
  With newitem
    .Caption = mCaption
    .Level = mLevel
    .IsParent = mIsParent
    .Visible = IIf(IsMissing(mVisible), True, mVisible)
    .Expanded = IIf(IsMissing(mExpanded), True, mExpanded)
    .VisibleIdx = IIf(IsMissing(mVisibleIdx), 0, mVisibleIdx)
    .Bookmark = IIf(IsMissing(mBookmark), "", mBookmark)
    .BmpFileName = IIf(IsMissing(mBmpFileName), "", mBmpFileName)
    .Selected = IIf(IsMissing(mSelected), 0, mSelected)
    .SyncIdx = IIf(IsMissing(mSyncIdx), 0, mSyncIdx)
    .ItemData = IIf(IsMissing(mItemData), 0, mItemData)
  End With
   
  Debug.Print mNodes.Levels
  prvNodes.Add newitem
  'Add = True
  
End Function

Public Function Count() As Integer
  Count = prvNodes.Count
End Function

Public Function Item(ByVal key As Variant) As Object
Attribute Item.VB_UserMemId = 0
  On Error GoTo errorexit
  If VarType(key) = vbString Then
    key = Trim(key)
  End If
  
  Set Item = prvNodes.Item(key)
  Exit Function
  
errorexit:
  
End Function

Public Function Clear() As Variant
  On Error GoTo errorexit
  
  Do Until prvNodes.Count = 0
    prvNodes.Remove 1
  Loop
  
  Clear = True
  
  On Error GoTo 0
  
Exit Function
errorexit:
      
End Function

Public Function Remove(index As Integer) As Variant
  On Error GoTo errorexit
  
  prvNodes.Remove index
  
  Remove = True
  
  On Error GoTo 0
  
Exit Function
errorexit:
      
End Function

